<!DOCTYPE html>
<html class="loading" lang="en" data-textdirection="">
<head>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script src="../js/func.js?v=1.0" type="text/javascript"></script>
<script src="../js/func.js?v=1.0" type="text/javascript"></script>
<script src="../js/jquery-ui-1.10.4.min.js" type="text/javascript"></script>
<script src="../js/jquery.serializejson.js" type="text/javascript"></script>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
  <meta name="description" content="Modern admin is super flexible, powerful, clean &amp; modern responsive bootstrap 4 admin template with unlimited possibilities with bitcoin dashboard.">
  <meta name="keywords" content="admin template, modern admin template, dashboard template, flat admin template, responsive admin template, web app, crypto dashboard, bitcoin dashboard">
  <meta name="author" content="PIXINVENT">
  <title>登录
  </title>
  <link rel="apple-touch-icon" href="../images/ico/apple-icon-120.png">
  <link rel="shortcut icon" type="image/x-icon" href="../images/ico/favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Quicksand:300,400,500,700"
  rel="stylesheet">
  <link href="https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome.min.css"
  rel="stylesheet">
  <!-- BEGIN VENDOR CSS-->
  <link rel="stylesheet" type="text/css" href="../css/vendors.css">
  <link rel="stylesheet" type="text/css" href="../vendors/css/forms/icheck/icheck.css">
  <link rel="stylesheet" type="text/css" href="../vendors/css/forms/icheck/custom.css">
  <!-- END VENDOR CSS-->
  <!-- BEGIN MODERN CSS-->
  <link rel="stylesheet" type="text/css" href="../css/app.css">
  <!-- END MODERN CSS-->
  <!-- BEGIN Page Level CSS-->
  <link rel="stylesheet" type="text/css" href="../css/core/menu/menu-types/vertical-menu.css">
  <link rel="stylesheet" type="text/css" href="../css/core/colors/palette-gradient.css">
  <link rel="stylesheet" type="text/css" href="../css/pages/login-register.css">
  <!-- END Page Level CSS-->
  <!-- BEGIN Custom CSS-->
  <link rel="stylesheet" type="text/css" href="../css/style.css">
  <!-- END Custom CSS-->
</head>
<body class="vertical-layout vertical-menu 1-column   menu-expanded blank-page blank-page"
data-open="click" data-menu="vertical-menu" data-col="1-column">
  <!-- ////////////////////////////////////////////////////////////////////////////-->
  <div class="app-content content">
    <div class="content-wrapper">
      <div class="content-header row">
      </div>
      <div class="content-body">
        <section class="flexbox-container">
          <div class="col-12 d-flex align-items-center justify-content-center">
            <div class="col-md-4 col-10 box-shadow-2 p-0">
              <div class="card border-grey border-lighten-3 m-0">
                <div class="card-header border-0">
                  <div class="card-title text-center">
                    <div class="p-1">
                      <img src="../images/logo/logo-dark.png" alt="branding logo">
                    </div>
                  </div>
                  <h6 class="card-subtitle line-on-side text-muted text-center font-small-3 pt-2">
                    <span>帐户登录</span>
                  </h6>
                </div>
                <div class="card-content">
                  <div class="card-body">
                    <!-- <form class="form-horizontal form-simple"> -->
                      <fieldset class="form-group position-relative has-icon-left mb-0">
                        <input type="text" class="form-control form-control-lg input-lg" id="user-name" onkeyup="value=value.replace(/[\u4e00-\u9fa5]/ig,'')" placeholder="帐户名"
                        required>
                        <div class="form-control-position">
                          <i class="ft-user"></i>
                        </div>
                      </fieldset>
                      <fieldset class="form-group position-relative has-icon-left">
                        <input type="password" class="form-control form-control-lg input-lg" id="user-password"
                        placeholder="密 码" required>
                        <div class="form-control-position">
                          <i class="la la-key" style="color:#ababab;"></i>
                        </div>
                      </fieldset>
                      <div class="form-group row">
                        <div class="col-md-6 col-12 text-center text-md-left">
                          <fieldset>
                            <!-- <input type="checkbox" id="remember-me" class="chk-remember"> -->
                            <!-- <label for="remember-me">记住密码</label> -->
                          </fieldset>
                        </div>
                        <!-- <div class="col-md-6 col-12 text-center text-md-right"><a href="recover-password.html" class="card-link">忘记密码?</a></div> -->
                      </div>
                      <button onclick="login()" class="btn btn-info btn-lg btn-block"> 点击登录</button>
                    <!-- </form> -->
                  </div>
				  <script>
					function login(){
							var username=document.getElementById("user-name").value;
							var password=document.getElementById("user-password").value;
							$.ajax({
								dataType:"json",
								type:"post",
								contentType: 'application/x-www-form-urlencoded',
								//url:"http://47.105.220.31:4000/users",
                                url:"/userLogin",
								data:{"username":username,"password":password},
								success: function (result) {
								  console.log(result)
									if(result.code==0){
									  var x = result.msg.split(',');
									  console.log(x[0])
                                      console.log(x[1])
										Cookies.set('loginname',username);
										Cookies.set("usertype",x[0]);
										if(x[1]!="")
                                            Cookies.set('token',x[1]);
                                      Cookies.set('unittype',x[2]);
                                      Cookies.set('usertype',x[3]);
                                      Cookies.set('transaction',x[4]);
                                      Cookies.set('username',x[5]);
                                      Cookies.set('userid',x[6]);
										window.location.href="toindex";
									}else{
									  my_confirm(result.msg,function () {
                                        if (result.code == -1) {
                                          window.location.href = "toAdminRegister";
                                        } else if (result.code == -2) {
                                          window.location.href = "toUpdateUser";
                                        } else {
                                          window.location.reload();
                                        }
                                      })
                                    }
								},
								error: function (jqXHR, textStatus, errorThrown) {
                                  console.log(jqXHR);
                                  console.log(textStatus);
                                  console.log(errorThrown);
							}
							});
						}
				  </script>
                </div>
                <div class="card-footer">
                  <div class="">
                    <p class="float-sm-left text-center m-0"><a href="recover-password.html" class="card-link">重置密码</a></p>
                    <p class="float-sm-right text-center m-0"><a href="/toSearchDetails" class="card-link">公众查询</a></p>
                  </div>
                </div>
                <div class="card-footer">
                  <div class="">
                    <p class="float-sm-left text-center m-0"><a href="/register" class="card-link">注册</a></p>

                  </div>
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
    </div>
  </div>
  <!-- ////////////////////////////////////////////////////////////////////////////-->
  <!-- BEGIN VENDOR JS-->
  <script src="../vendors/js/vendors.min.js" type="text/javascript"></script>
  <!-- BEGIN VENDOR JS-->
  <!-- BEGIN PAGE VENDOR JS-->
  <script src="../vendors/js/forms/icheck/icheck.min.js" type="text/javascript"></script>
  <script src="../vendors/js/forms/validation/jqBootstrapValidation.js"
  type="text/javascript"></script>
  <!-- END PAGE VENDOR JS-->
  <!-- BEGIN MODERN JS-->
  <script src="../js/core/app-menu.js" type="text/javascript"></script>
  <script src="../js/core/app.js" type="text/javascript"></script>
  <!-- END MODERN JS-->
  <!-- BEGIN PAGE LEVEL JS-->
  <script src="../js/scripts/forms/form-login-register.js" type="text/javascript"></script>
  <!-- END PAGE LEVEL JS-->
</body>
</html>